<template>
    <div :style="{ display: 'flex' }" id="infoCardHClass">
      <a-card
        :style="{ width: '360px' }"
        class="card"
        v-for="info in infos"
        :key="info.infoId"
        :title="info.infoTitle"
      >
        {{ info.infoText }}<br />
        <a-button class="btSure" @click="sure(info.infoId)"
          >确认发布</a-button
        >
      </a-card>
    </div>
  </template>
      
  <script>
  import axios from "axios";
  
  export default {
    data() {
      return {
        infos: [
          {
            infoId: 1,
            infoTitle: "班级公告",
            infoText: "这是一个班级公告内容",
            isDelete: 0,
          },
        ],
      };
    },
    methods: {
      sure(id) {
        axios
          .post("/suerClassInfo", {
            classInfoId: id,
          })
          .then((response) => {
            if (response) {
              alert("审核通过");
            } else {
              alert("发生了错误");
            }
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      
    },
    mounted() {
      axios
        .get("/allClassInfo")
        .then((response) => {
          this.infos = response.data;
        })
        .catch(function (error) {
          console.log(error);
        });
    },
  };
  </script>
        
      <style >
  #infoCardHClass {
    padding: 100px;
  }
  #infoCardHClass .card {
    margin: 20px;
  }
  #infoCardHClass .btSure {
    margin-top: 25px;
  }
  </style>